const { merge } = require('webpack-merge')
const webpack = require('webpack')

const commonConfig = require('./webpack.common')

/**
 * @type { import('webpack').Configuration }
 */
const devConfig = {
  mode: 'development',
  devtool: 'eval-cheap-module-source-map',
  devServer: {
    contentBase: './public',
    open: true,
    hot: true, // TODO: 热更新无效
    hotOnly: true
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoEmitOnErrorsPlugin()
  ]
}

module.exports = merge(commonConfig, devConfig)
